package tedu.week04.day02_thread.lesson2;

/**
 * <pre>
 *      线程的操作示例①.
 *          通过继承实现练习.
 * </pre>
 *
 * @author : resty
 * @date : 2019年07月09日    10时
 **/
public class MyThread extends Thread {
    private int time;
    public MyThread(String name,int time) {
        super(name);
        this.time = time;
    }
    @Override
    public void run() {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("当前线程:"+Thread.currentThread().getName()+"休眠了"+time+"ms");
    }
    public static void main(String[] args){
      MyThread mt1 = new MyThread("A",10000);
      MyThread mt2 = new MyThread("B",20000);
      MyThread mt3 = new MyThread("C",30000);
      mt1.start();
      mt2.start();
      mt3.start();
    }
}
